createRewarded

fun createRewarded(configurationID: String, activity: Activity, afterInterstitial: () -> Unit, rewardReceived: (<Error class: unknown class>) -> Unit, lifecycleCallbacks: <Error class: unknown class>? = null): Int

Creates Rewarded Interstitial ad which will be shown when ever you want to provide a reward in exchange for showing an ad.

  • You MUST configure here how to resume you app on the afterInterstitial event. This is equivalent to RewardedInterstitialEventListener.onAdDismissedFullScreenContent But safer because we guarantee that with afterInterstitial you will be able to resume your app.

  • You MUST configure what to do when the user receives the reward in rewardReceived event. This is equivalent to RewardedInterstitialEventListener.onRewardEarned But we force you to implement it here in rewardReceived since it's an essential part of the format, you can still use the RewardedInterstitialEventListener to know when the events are called, debug, just be careful not to give the reward twice.

Return

the id Int of the object for the factory to manage it

Parameters

configurationID

id used to fetch the unit configuration

activity

current activity where the interstitial must be shown, if activity dies the interstitial will be invalidated and destroyed

afterInterstitial

this is called after ad fails to show or user closes the fullscreen

rewardReceived

this is called when the user receives the reward after seeing the ad properly. it will return a RewardItem with the reward information.

lifecycleCallbacks

(optional) go to RewardedInterstitialEventListener to know when the callbacks are called